package com.erp.auto.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.erp.auto.domain.ErpAutoGoldCoinConfig;
import com.erp.auto.service.ErpAutoGoldCoinConfigService;
import com.ruoyi.common.core.domain.R;
import lombok.AllArgsConstructor;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*;


/**
 * 自动化店铺金币配置
 *
 * @author WXX
 * @date 2024-01-25 16:50:03
 */
@RestController
@AllArgsConstructor
@RequestMapping("/kjerp/erpAutoGoldCoinConfig" )
public class ErpAutoGoldCoinConfigController {

    private final ErpAutoGoldCoinConfigService erpAutoGoldCoinConfigService;

    /**
     * 查看
     */
    @GetMapping("/selectByStoreId")
    public R<Object> selectByStoreId(Long storeId) {
        ErpAutoGoldCoinConfig one = erpAutoGoldCoinConfigService.getOne(new LambdaQueryWrapper<ErpAutoGoldCoinConfig>()
                .eq(ErpAutoGoldCoinConfig::getStoreId, storeId));
        return R.ok(one);
    }

    @GetMapping("/selectById")
    public R<Object> selectById(@Param("id") Long id) {
        ErpAutoGoldCoinConfig one = erpAutoGoldCoinConfigService.getById(id);
        return R.ok(one);
    }

    @PostMapping("/saveGoldCoinConfig")
    public R<Object> saveGoldCoinConfig(@RequestBody ErpAutoGoldCoinConfig config) {

        return erpAutoGoldCoinConfigService.saveGoldCoin(config);
    }

}
